function splitMoviceUrl(url){
	let list = [];
	let index = 1;
	if(url.indexOf("$$$") != -1){
		let threads = url.split("$$$");
		if(threads.length > 0){
			for(let thread of threads){
				list.push({"thread":index++,movices:splitMoviceThread(thread)});
			}
		}
	}else{
		list.push({"thread":index++,movices:splitMoviceThread(url)});
	}
	return list;
}


function splitMoviceThread(url){
	let list = [];
	if(url.indexOf("#") != -1){
		let chapters = url.split("#");
		if(chapters.length > 0){
			list = splitMoviceChapter(chapters);
		}
	}else if(url.indexOf("$") != -1){
		list = splitMoviceChapter([url]);
	}
	return list;
}

function splitMoviceChapter(chapters){
	let list = [];
	for (let chapter of chapters) {
		if(chapter.indexOf("$") != -1){
			let item = chapter.split("$");
			if(item.length == 2){
				let json = {
					"index":item[0],
					"url":item[1],
					"select":0
				};
				list.push(json);
			}
		}
	}
	return list;
}

export default{
	splitMoviceUrl
}